<?php

function addToCart($prodCode) {
	$dao = new SQLitePersistence();

	if ($dao->isProdCodeExist($prodCode))
	{
		$pos = strpos($_SESSION['my_cart'], $prodCode);

		if ($pos === false)
		{
			if ($_SESSION['my_cart'])
				$_SESSION['my_cart'] = $_SESSION['my_cart'] . ";" . $prodCode;
			else
				$_SESSION['my_cart'] = $prodCode;

			return 1;
		}
	}

	unset($dao);
	return 0;
}

?>